package com.lanlian.cayman.widget;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

import com.example.utils.DensityUtil;


/**
 *
 */
public class MyImageView extends View {
    public int color=0xff4385F3;
    Context context;
    public MyImageView(Context context) {
        super(context);
        this.context=context;

        initView();
    }

    public MyImageView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        setDrawingCacheEnabled(true);
        this.context=context;
        initView();
    }
    private void initView()
    {

    }
    public void setColor(int color)
    {
        this.color=color;
        invalidate();
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        int width=getWidth();
        //设置画笔
        Paint paint=new Paint();
        paint.setAntiAlias(true);
        paint.setColor(color);

        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(2);

        //画圆
        canvas.drawCircle(width/2,width/2,width/2,paint);

        //设置画笔
        Paint paint2=new Paint();
        paint2.setAntiAlias(true);
        paint2.setColor(color);
        paint2.setStyle(Paint.Style.FILL_AND_STROKE);

        //画圆
        canvas.drawCircle(width/2,width/2,width/2-5,paint2);
    }

}
